package com.acxy.weixin.controller;

import com.acxy.ants.core.annotation.Autowired;
import com.acxy.ants.resful.annotation.Controller;
import com.acxy.ants.resful.annotation.GET;
import com.acxy.weixin.service.WxMenuService;

/**
 * @author MrShun
 * @version 1.0
 * @Date 2017-11-04
 */
@Controller("menu")
public class WxMenuController {

    @Autowired
    private WxMenuService menuService;

    //查询所有自定义菜单
    @GET("/find")
    public Object find(){
        return menuService.getMenu();
    }

    //自定义菜单删除接口可以删除所有自定义菜单（包括默认菜单和全部个性化菜单）
    @GET("/delete")
    public Object delete(){
        return menuService.deleteMenu();
    }


    //创建自定义菜单
    @GET("/create")
    public Object create(){
        String body = "{\"button\": [\n" +
                "            {\n" +
                "                \"name\": \"自助查询\", \n" +
                "                \"sub_button\": [\n" +
                "                    {\n" +
                "                        \"type\": \"view\", \n" +
                "                        \"name\": \"☀天气预报\", \n" +
                "                        \"url\": \"http://m.weather.com.cn/\", \n" +
                "                        \"sub_button\": [ ]\n" +
                "                    }, \n" +
                "                    {\n" +
                "                        \"type\": \"view\", \n" +
                "                        \"name\": \"\uD83D\uDCE6快递查询\", \n" +
                "                        \"url\": \"http://m.cnblogs.com/?u=txw1958\", \n" +
                "                        \"sub_button\": [ ]\n" +
                "                    }, \n" +
                "                    {\n" +
                "                        \"type\": \"view\", \n" +
                "                        \"name\": \"\uD83C\uDF4E苹果产品\", \n" +
                "                        \"url\": \"http://m.cnblogs.com/?u=txw1958\", \n" +
                "                        \"sub_button\": [ ]\n" +
                "                    }, \n" +
                "                    {\n" +
                "                        \"type\": \"view\", \n" +
                "                        \"name\": \"\uD83D\uDE4F四六级成绩\", \n" +
                "                        \"url\": \"http://m.cnblogs.com/?u=txw1958\", \n" +
                "                        \"sub_button\": [ ]\n" +
                "                    }\n" +
                "                ]\n" +
                "            }, \n" +
                "            {\n" +
                "                \"name\": \"每日更新\", \n" +
                "                \"sub_button\": [\n" +
                "                    {\n" +
                "                        \"type\": \"click\", \n" +
                "                        \"name\": \"\uD83D\uDCC5历史今天\", \n" +
                "                        \"key\": \"HISTORY\", \n" +
                "                        \"sub_button\": [ ]\n" +
                "                    }, \n" +
                "                    {\n" +
                "                        \"type\": \"click\", \n" +
                "                        \"name\": \"\uD83C\uDDFA\uD83C\uDDF8每日英语\", \n" +
                "                        \"key\": \"ENGLISH\", \n" +
                "                        \"sub_button\": [ ]\n" +
                "                    }, \n" +
                "                    {\n" +
                "                        \"type\": \"click\", \n" +
                "                        \"name\": \"\uD83D\uDCC8股票指数\", \n" +
                "                        \"key\": \"STOCK\", \n" +
                "                        \"sub_button\": [ ]\n" +
                "                    }, \n" +
                "                    {\n" +
                "                        \"type\": \"click\", \n" +
                "                        \"name\": \"\uD83C\uDF0F最新地震\", \n" +
                "                        \"key\": \"EARTHQUAKE\", \n" +
                "                        \"sub_button\": [ ]\n" +
                "                    }, \n" +
                "                    {\n" +
                "                        \"type\": \"click\", \n" +
                "                        \"name\": \"\uD83D\uDE03开心一笑\", \n" +
                "                        \"key\": \"JOKE\", \n" +
                "                        \"sub_button\": [ ]\n" +
                "                    }\n" +
                "                ]\n" +
                "            }, \n" +
                "            {\n" +
                "                \"name\": \"互动交流\", \n" +
                "                \"sub_button\": [\n" +
                "                    {\n" +
                "                        \"type\": \"click\", \n" +
                "                        \"name\": \"\uD83D\uDCC6每日签到\", \n" +
                "                        \"key\": \"SIGNIN\", \n" +
                "                        \"sub_button\": [ ]\n" +
                "                    }, \n" +
                "                    {\n" +
                "                        \"type\": \"view\", \n" +
                "                        \"name\": \"\uD83D\uDC40社区交流\", \n" +
                "                        \"url\": \"http://wx.wsq.qq.com/182998484\", \n" +
                "                        \"sub_button\": [ ]\n" +
                "                    }\n" +
                "                ]\n" +
                "            }\n" +
                "        ], \n" +
                "        \"menuid\": 401260075\n" +
                "    }, \n" +
                "    \"conditionalmenu\": [\n" +
                "        {\n" +
                "            \"button\": [\n" +
                "                {\n" +
                "                    \"name\": \"自助查询\", \n" +
                "                    \"sub_button\": [\n" +
                "                        {\n" +
                "                            \"type\": \"view\", \n" +
                "                            \"name\": \"☀天气预报\", \n" +
                "                            \"url\": \"http://m.weather.com.cn/\", \n" +
                "                            \"sub_button\": [ ]\n" +
                "                        }, \n" +
                "                        {\n" +
                "                            \"type\": \"view\", \n" +
                "                            \"name\": \"\uD83D\uDCE6快递查询\", \n" +
                "                            \"url\": \"http://m.cnblogs.com/?u=txw1958\", \n" +
                "                            \"sub_button\": [ ]\n" +
                "                        }, \n" +
                "                        {\n" +
                "                            \"type\": \"view\", \n" +
                "                            \"name\": \"\uD83C\uDF4E苹果产品\", \n" +
                "                            \"url\": \"http://m.cnblogs.com/?u=txw1958\", \n" +
                "                            \"sub_button\": [ ]\n" +
                "                        }, \n" +
                "                        {\n" +
                "                            \"type\": \"view\", \n" +
                "                            \"name\": \"\uD83D\uDE4F四六级成绩\", \n" +
                "                            \"url\": \"http://m.cnblogs.com/?u=txw1958\", \n" +
                "                            \"sub_button\": [ ]\n" +
                "                        }\n" +
                "                    ]\n" +
                "                }, \n" +
                "                {\n" +
                "                    \"name\": \"每日更新\", \n" +
                "                    \"sub_button\": [\n" +
                "                        {\n" +
                "                            \"type\": \"click\", \n" +
                "                            \"name\": \"\uD83D\uDCC5历史今天\", \n" +
                "                            \"key\": \"HISTORY\", \n" +
                "                            \"sub_button\": [ ]\n" +
                "                        }, \n" +
                "                        {\n" +
                "                            \"type\": \"click\", \n" +
                "                            \"name\": \"\uD83C\uDDFA\uD83C\uDDF8每日英语\", \n" +
                "                            \"key\": \"ENGLISH\", \n" +
                "                            \"sub_button\": [ ]\n" +
                "                        }, \n" +
                "                        {\n" +
                "                            \"type\": \"click\", \n" +
                "                            \"name\": \"\uD83D\uDCC8股票指数\", \n" +
                "                            \"key\": \"STOCK\", \n" +
                "                            \"sub_button\": [ ]\n" +
                "                        }, \n" +
                "                        {\n" +
                "                            \"type\": \"click\", \n" +
                "                            \"name\": \"\uD83C\uDF0F最新地震\", \n" +
                "                            \"key\": \"EARTHQUAKE\", \n" +
                "                            \"sub_button\": [ ]\n" +
                "                        }, \n" +
                "                        {\n" +
                "                            \"type\": \"click\", \n" +
                "                            \"name\": \"\uD83D\uDE03开心一笑\", \n" +
                "                            \"key\": \"JOKE\", \n" +
                "                            \"sub_button\": [ ]\n" +
                "                        }\n" +
                "                    ]\n" +
                "                }, \n" +
                "                {\n" +
                "                    \"name\": \"互动交流\", \n" +
                "                    \"sub_button\": [\n" +
                "                        {\n" +
                "                            \"type\": \"click\", \n" +
                "                            \"name\": \"\uD83D\uDCC6每日签到\", \n" +
                "                            \"key\": \"SIGNIN\", \n" +
                "                            \"sub_button\": [ ]\n" +
                "                        }, \n" +
                "                        {\n" +
                "                            \"type\": \"view\", \n" +
                "                            \"name\": \"\uD83D\uDC40社区交流\", \n" +
                "                            \"url\": \"http://wx.wsq.qq.com/182998484\", \n" +
                "                            \"sub_button\": [ ]\n" +
                "                        }, \n" +
                "                        {\n" +
                "                            \"type\": \"view\", \n" +
                "                            \"name\": \"\uD83C\uDF65五家渠人\", \n" +
                "                            \"url\": \"http://wx.wsq.qq.com/182998484\", \n" +
                "                            \"sub_button\": [ ]\n" +
                "                        }\n" +
                "                    ]\n" +
                "                }\n" +
                "            ], \n" +
                "            \"matchrule\": {\n" +
                "                \"sex\": \"1\", \n" +
                "                \"country\": \"中国\", \n" +
                "                \"province\": \"新疆\", \n" +
                "                \"city\": \"五家渠\"\n" +
                "            }, \n" +
                "            \"menuid\": 401285125\n" +
                "        }\n" +
                "    ]\n" +
                "}";
        return menuService.createMenu(body);
    }
}
